package com.leizhou.ccontroller;


import com.leizhou.configuration.UserProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/** 第三种方式: 注入属性 */
@RestController
public class PropController03 {

    @Autowired(required = false)
    private UserProperties userProperties;

    @GetMapping("/test3")
    public String test3(){
        System.out.println("======test3======");
        System.out.println(userProperties.getHost());
        System.out.println(userProperties.getPort());
        System.out.println(userProperties.getUser());
        System.out.println(userProperties.getAddress());
        System.out.println(userProperties.getUsers());
        return "test3方法，访问成功！";
    }
}